home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000039_icon-group-sender _Fri Oct 23 18:35:37 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  4KB

  1. Received: by cheltenham.cs.arizona.edu; Wed, 28 Oct 1992 09:35:27 MST
  2. Date: 23 Oct 92 18:35:37 GMT
  3. From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU  (Richard L. Goerwitz)
  4. Organization: University of Chicago Computing Organizations
  5. Subject: Re: confusing errors
  6. Message-Id: <1992Oct23.183537.6160@midway.uchicago.edu>
  7. References: <SPACKMAN.92Oct15130722@disco-sol.dfki.uni-sb.de>, <1992Oct15.155939.2562@midway.uchicago.edu>, <SPACKMAN.92Oct23174836@disco-sun6.dfki.uni-sb.de>
  8. Sender: icon-group-request@cs.arizona.edu
  9. To: icon-group@cs.arizona.edu
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13. stephen@acm.org writes:
  14.  
  15. >|>|If anybody find the Icon tokenizer interesting (automatic semicolon inser-
  16. >|>|tion is really a great idea - why don't all languages do it?), then here's
  17. >|>|a fun program.
  18. >|>
  19. >|>Makes about as much sense as automatic plus insertion or automatic
  20. >|>atanh() insertion, if you ask me.
  21. >|
  22. >|I didn't ask, Stephen, but since you interject I respond with a basic
  23. >|remark about tokens and their semantics:  Some terminals map to nodes
  24. >|in the abstract syntax tree; some only demarcate expressions.  When and
  25. >|if they are superfluous, they should be eliminated, as long as doing so
  26. >|does not render the language more opaque.
  27. >
  28. >But but but. The semicolon operator DOES have semantics: it explicitly
  29. >evaluates and discards its left argument and returns its right! It's the
  30. >most drastic operator in the book! Now *parentheses*, I grant, don't do
  31. >anything at abstract syntax. Wanna make THOSE optional?
  32.  
  33. But but but!  Parentheses serve to group expressions where the precedences
  34. or associativities are not clear.  There are only a couple of declarations
  35. in Icon; just about everything else can be an expression.  So there's no
  36. practical need for the semicolon:  If anyone is confused, use parentheses.
  37. To bound an expression a line-break is quite enough.  Just as clear as a
  38. semicolon.  If one wants to compact several bounded expressions onto a
  39. single line, then the semicolon *may* be used.  The following is perfectly
  40. legal Icon code:
  41.  
  42.     procedure main()
  43.         write("hello world"); exit(0)
  44.     end
  45.  
  46. The following is also legal:
  47.  
  48.     procedure main()
  49.         write("hello world")
  50.         exit(0)
  51.     end
  52.  
  53. After you read Icon for a couple of weeks, superfluous semicolons start to
  54. seem like an annoying tick.  There's no reason for them.  The analyzer can
  55. figure things out perfectly well without them.
  56.  
  57. >|Opacity is a subjective judgment, of course, so let's check to see if
  58. >|you know Icon in the first place.  Can you illustrate where automatic
  59. >|semicolon insertion might render Icon source code less readable, or
  60. >|introduce unexpected behavior?  I'm waiting....
  61. >
  62. >Nono, not my point. It reduces regularity in the language, limits the
  63. >ease with it can be read and written automatically, and increases the
  64. >potential for errors to be introduced during the editing process.
  65.  
  66. If you like regularity, just use LISP.  It is very easy to read and write
  67. automatically, and its syntax is trivial.  In fact, Icon is very easy to
  68. tokenize with automatic semicolon insertion, and I've never had any prob-
  69. lems reading or writing it.  Not as regular as LISP, but then LISP code
  70. is really not all that readable unless formatted with great skill (and a
  71. smart editor).  Syntactic regularity != usability.
  72.  
  73. Maybe you are just baiting me, but the semicolon is not an operator with
  74. abstract semantics.  It has semantics only in the sense that it directs the
  75. syntactic analyzer to map the concrete syntax to the abstract syntax in a
  76. certain way.  If this action can be determined easily enough without the
  77. extra symbol, then why use it?  Make it optional for those few cases where
  78. clarity would be served by its addition.
  79.  
  80. -- 
  81.  
  82.    -Richard L. Goerwitz              goer%midway@uchicago.bitnet
  83.    goer@midway.uchicago.edu          rutgers!oddjob!ellis!goer
  84.